<template>
	<view>
        <u-navbar
			:height="height"
			:title="title"
            @leftClick="leftClick"
            :autoBack="autoBack"
			:bgColor="bgColor"
			fixed
			safeAreaInsetTop
			placeholder
			:leftIcon="leftIcon"
			:leftText="leftText"
        >
        </u-navbar>
	</view>
</template>

<script>
	export default {
		props:{
			bgColor:{
				default:'#7aaffe'
			},
			title:{
				type:String,
				default:''
			},
			autoBack:{
				type:Boolean,
				default:true
			},
			leftIcon:{
				type:String,
				default:'arrow-left'
			},
			leftText:{
				type:String,
				default:''
			}
		},
		data() {
			return {
				height:44
			}
		},
		methods:{
		    leftClick() {
				//获取当前页面的左侧图标以判断在何页面
				let curRoute = this.$mp.component.data.leftIcon
				// 首页
				if(curRoute === 'map'){
					uni.navigateTo({
						url: '../selectCity/selectCity'
					})
				}
		    }
		}
	}
</script>